home *** CD-ROM | disk | FTP | other *** search
- /*----------------------------------------------------------
- #
- # NewsWatcher - Macintosh NNTP Client Application
- #
- # Written by Steven Falkenburg
- # ©1990 Apple Computer, Inc.
- #
- #-----------------------------------------------------------
- #
- # mylistdef.c
- #
- # This module contains the LDEF which will be compiled and
- # linked into the rest of the NewsWatcher application.
- #
- #-----------------------------------------------------------*/
-
- #include <Types.h>
- #include <QuickDraw.h>
- #include <Packages.h>
- #include <Lists.h>
- #include <SysEqu.h>
- #include <ToolUtils.h>
-
-
- /* This is the list definintion used for all list manager lists in
- NewsWatcher. This list def allows for bold text, and will automatically
- narrow text lines which wouldn't otherwise fit across the list.
- */
-
- pascal void main(short lMessage,Boolean lSelect,Rect *lRect,Cell lCell,short lDataOffset,short lDataLen,ListHandle lHandle)
- {
- #pragma unused (lCell)
-
- FontInfo fontInfo;
- short face;
-
- switch (lMessage) {
- case lInitMsg:
- break;
-
- case lDrawMsg:
- if (lDataLen > 0) {
- EraseRect(lRect);
- GetFontInfo(&fontInfo);
- MoveTo(lRect->left+(**lHandle).indent.h,lRect->top+fontInfo.ascent);
- HLock( (Handle) (**lHandle).cells );
-
- face = 0;
- if ( (unsigned char) *((*((**lHandle).cells))+lDataOffset+lDataLen-1) == 0xff ) {
- lDataLen--;
- face = 0;
- }
- else
- face |= bold;
- (**lHandle).port->txFace = face;
- if (TextWidth( (Ptr) (*((**lHandle).cells)),lDataOffset,lDataLen-1) > (lRect->right-lRect->left-(**lHandle).indent.h))
- face |= condense;
-
- (**lHandle).port->txFace = face;
- DrawText( (Ptr) (*((**lHandle).cells)),lDataOffset,lDataLen-1);
- HUnlock( (Handle) (**lHandle).cells );
- }
- else
- EraseRect(lRect);
-
- /* stop if no selection is needed */
- if (!lSelect)
- break;
-
- case lHiliteMsg:
- BitClr((Ptr)HiliteMode,pHiliteBit);
- InvertRect(lRect);
- break;
-
- case lCloseMsg:
- break;
- }
- }
-
-